package com.roc.util;

import org.apache.commons.lang3.StringUtils;

public class PageUtil {

	private int pageSize = 5;
	private int totalPage;
	// 当前页数
	private String currentPage;
	// 当前数据获取起点
	private int currentStart;
	// 当前数据获取终点
	private int currentEnd;

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getTotalPage() {
		return totalPage;
	}

	public void setTotalPage(int totalPage) {
		this.totalPage = totalPage;
	}

	public int getCurrentPage() {
		if (StringUtils.isBlank(currentPage)) {
			currentPage = "1";
		}
		return Integer.parseInt(currentPage);
	}

	public void setCurrentPage(String currentPage) {
		this.currentPage = currentPage;
	}

	public int getCurrentStart() {
		return pageSize * (getCurrentPage() - 1);
	}

	public int getCurrentEnd() {
		return pageSize * getCurrentPage();
	}
}
